import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from '@/App.vue'
import router from '@/router'
import ElementPlus from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

// 全局样式
import '@/styles/var.less'
import '@/styles/mixin.less'
import '@/styles/global.less'

const app = createApp(App)

// 设置全局变量
app.provide('operatorType', {
  value: 1,
})

// 全局注册el-icon
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app
  .use(createPinia()) // 启用 Pinia
  .use(router)
  .use(ElementPlus, {
    locale: zhCn,
  })
  .use(ElMessage)
  .use(ElMessageBox)
  .mount('#app')
